package com.jiazhong.查找;

import java.util.Scanner;

public class Shunxu {
    public static void main(String[] args) {
        String a[]={"老师","你","冒泡排序","讲错","了"};
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入你要找的名称");
        String findName=scanner.next();
        boolean flag=false;
        int index=-1;
        for (int i=0;i<a.length;i++){
            if (findName.equals(a[i])){
                System.out.println("恭喜你找到了");
                flag=true;
                index=i;
                System.out.println("其下标为"+index);
                break;
            }
        }
        if (flag=false){
            System.out.println("对不起没找到");
        }
    }
}
